/**
 * core服务类
 */
import {Interaction} from './iteraction/interaction.interface';
import {WebService} from './iteraction/web.service';
import {MpService} from './iteraction/mp.service';
import {BrowserService} from './browser.service';
import {DateService} from './date.service';
import {DomService} from './dom.service';
import {EnvService} from './env.service';
import {ImgService} from './img.service';
import {MathService} from './math.service';
import {PageService} from './page.service';
import {RegExpService} from './regexp.service';
import {StringService} from './string.service';
import {UtilsService} from './util.service';

import {AndroidService} from './iteraction/android.service';
import { IosService } from './iteraction/ios.service';
class Core {
	/** 交互类 */
	public interaction:Interaction;
	// #ifndef MP
	/** 浏览器服务类 */
	public browser: BrowserService = new BrowserService();// 小程序端会报错，所以小程序端不注入这个服务
	public env: EnvService = new EnvService();// 小程序端会报错，所以小程序端不注入这个服务
	public img:ImgService = new ImgService();
	public page: PageService = new PageService();
	// #endif
	/** 时间服务类 */
	/** dom操作交互类 */
	public dom: DomService= new DomService();
	public date: DateService = new DateService();
	public math:MathService = new MathService();
	public regexp : RegExpService = new RegExpService();
	public string : StringService = new StringService();
	public util : UtilsService = new UtilsService();
	public andService: AndroidService = new AndroidService();
	public log : any;
	public config : any;
	constructor() {
		// todo 这里需要判断环境来区分生成何种交互类
		this.interaction = new WebService();
		// #ifndef MP
		this.interaction = new MpService();
		
		if(this.env.isAndroid){
			this.interaction = new AndroidService();
		}else if(this.env.isIosksdapp()){
			this.interaction = new IosService();
		}
		// #endif
		if(process.env.NODE_ENV === "development"){
			this.config = require("../config/dev.config.js").default
		}else {
			this.config = require("../config/pro.config.js").default
		}
	}
}
const core = new Core();

export default core;
